<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        function createArray(...elements) {
            let handler = {
                get(target, propKey, receiver) {
                    let index = Number(propKey);
                    if (index < 0) {
                        propKey = String(target.length + index)
                    }
                    return Reflect.get(target, propKey, receiver)
                }
            }

            let target = [];
            target.push(...elements);
            return new Proxy(target, handler);
        }

        let arr = createArray('a', 'b', 'c', 'd');
        console.log(arr);
        console.log(arr[-2]);

    </script>
</head>
<body>

</body>
</html>